<?php
header("content-type:text/html;charset=utf-8");
// 1.接收前端传来的数据
$name = $_POST['nam'];
$password = $_POST['password'];
$email = $_POST['email'];
$tel = $_POST['tel'];
// echo $nam;
// 2.处理（数据库操作）
	// 1),处理数据库
// $conn = mysqli_connect("localhost:3306","root","root","macdata");
$conn = mysqli_connect("localhost:3306","root","root","macdata");
if(!$conn){
	echo "服务器出错";
}else{
	// 2),执行sql语句
	$sql = "insert into user(name,password,email,tel) values('$name','$password','$email','$tel')";
	$result = mysqli_query($conn,$sql);
	// 3),关闭数据库
	mysqli_close($conn);
	if($result){
		echo 1;// 3、响应成功
	}
	else{
		echo 0; // 3、响应失败
	}
}
?>